home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / dev / lang / Python16_Src.lha / Python16_Source / Demo / sockets / radio.py < prev    next >
Encoding:
Python Source  |  1994-10-09  |  274 b   |  15 lines

  1. # Receive UDP packets transmitted by a broadcasting service
  2.  
  3. MYPORT = 50000
  4.  
  5. import sys
  6. from socket import *
  7.  
  8. s = socket(AF_INET, SOCK_DGRAM)
  9. s.bind(('', MYPORT))
  10.  
  11. while 1:
  12.     data, wherefrom = s.recvfrom(1500, 0)
  13.     sys.stderr.write(`wherefrom` + '\n')
  14.     sys.stdout.write(data)
  15.